package com.tsc.consumer.listener;

import com.tsc.consumer.message.PraiseMessage;
import com.tsc.consumer.service.PraiseService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.Message;

import java.util.function.Consumer;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: chentl
 * @Date: 2025/08/30/14:24
 * @Description:
 */
@Configuration
public class ListenerAutoConfiguration {

    @Bean
    public Consumer<Message<PraiseMessage>> consumer(PraiseService praiseService) {
        return msg -> {
            praiseService.praiseItem(msg.getPayload().getItemId());
        };
    }
}
